#include "rrprimset.h"
#include "rrcuboid.h"
#include "rrplane.h"
#include "rrquadric.h"
#include "rrprim.h"

RRPrimSet::RRPrimSet(RRTracer *arg)
{
    map_index = 0;
    parent = arg;
}

void RRPrimSet::rrSetPrim(RRPrim *arg)
{
    switch(arg->rrGetType()){
    case RR_CUBOID:
        primset[map_index] = new RRCuboid(parent);
        break;
    case RR_PLANE:
        primset[map_index] = new RRPlane(parent);
        break;
    case RR_QUADRIC:
        primset[map_index] = new RRQuadric(parent);
        break;
    }
    primset[map_index]->rrSetPrim(arg);
    primset[map_index]->rrSetPrimSet(this);
    //RRPrim *test = primset[map_index];
    //printf("%f\n", test->rrGetSpec());
    map_index += 1;
}

RRPrim *RRPrimSet::rrGetPrim(int index)
{
    return primset[index];
}

int RRPrimSet::rrBegin()
{
    return 0;
}

int RRPrimSet::rrEnd()
{
    return map_index;
}
